package com.demo2do.fms.admin.service.data.impl;

import java.util.List;
import java.util.Map;

import com.demo2do.fms.entity.data.MasterData;
import com.demo2do.fms.entity.data.business.VehicleFeature;

import org.springframework.stereotype.Service;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.utils.CollectionUtils;
import com.demo2do.fms.admin.dao.data.MasterDataDao;
import com.demo2do.fms.admin.service.data.MasterDataService;

/**
 * 
 * @author Ysy
 *
 */
@Service("masterDataService")
public class MasterDataServiceImpl implements MasterDataService{
    
    @Dao
    private MasterDataDao masterDataDao;
    
    
    /* (non-Javadoc)
     * @see com.demo2do.fms.admin.service.data.MasterDataService#get(java.lang.String, java.lang.Long)
     */
    public String load(String type, Long id) {
        return masterDataDao.get(type, id);
    }
    
    /*
     * (non-Javadoc)
     * @see com.demo2do.fms.admin.service.CostDataService#getOilType(java.lang.Long)
     */
    public String getOilType(Long oilTypeId) {
        return masterDataDao.getOilType(oilTypeId);
    }
    
    /* (non-Javadoc)
     * @see com.demo2do.fms.admin.service.data.CostDataService#list()
     */
    public Map<String, List<MasterData>> list() {
        List<MasterData> masterDatas = masterDataDao.list();
        return CollectionUtils.constructMapValues(masterDatas, "type");
    }
    
    /*
     * (non-Javadoc)
     * @see com.demo2do.fms.admin.service.data.MasterDataService#listOilType()
     */
    public List<MasterData> listOilType(){
        return masterDataDao.listOilType();
    }

    /* (non-Javadoc)
     * @see com.demo2do.fms.admin.service.data.MasterDataService#listShipmentStatus()
     */
    public List<MasterData> listShipmentStatus() {
        return masterDataDao.listShipmentStatus();
    }

    /* (non-Javadoc)
     * @see com.demo2do.fms.admin.service.data.MasterDataService#listVehicleFeature()
     */
    public List<VehicleFeature> listVehicleFeature() {
        return masterDataDao.listVehicleFeature();
    }
    
}
